Using null-coalescing to find item in multiple collections

A co-worker showed me this: var result = collection1.GetObjectByAtSpecialLocation(location) ?? collection1.GetObjectByAtLocation(parent, location) ?? collection2.GetObjectByAtSpecialLocation(location) ?? collection2.GetObjectByAtLocation(parent, location); I’m still trying to decide whether it’s a good practice and if it’s readable or not… In case you’re not familiar with ?? operator a.k.a null-coalescing operator it’s basically returns a default value if the left side is … Continue reading Using null-coalescing to find item in multiple collections